HDRImage

data class HDRImage(val width: Int = 1, val height: Int = 1, var pixels: Array<Color> = Array(width * height) { Color() })

Represents a High Dynamic Range (HDR) image stored in row-major order.

Constructors

Link copied to clipboard
constructor(width: Int = 1, height: Int = 1, pixels: Array<Color> = Array(width * height) { Color() })

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val height: Int

the number of vertical pixels

Link copied to clipboard

flat 1D array of Color values in row-major order

Link copied to clipboard
val width: Int

the number of horizontal pixels

Functions

Link copied to clipboard
fun averageLuminosity(delta: Float = 1.0E-10f): Float

Uses Color.luminosity to calculate the logarithmic mean of the image luminosity as L_avg = 10 ^ ( sum( log10(delta + L(pixel)) ) / N ). default parameter delta is to prevent black pixels from appearing in the output image

Link copied to clipboard

Applies the bright spot correction as x -> x / (1 + x)

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun getPixel(x: Int, y: Int): Color

Returns the Color of the pixel at (x, y).

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun normalizeImage(factor: Float, luminosity: Float? = null)

Renormalizes the luminosity of the image pixels.

Link copied to clipboard
fun pixelOffset(x: Int, y: Int): Int

Converts 2D coordinates (x, y) into a flat 1D array index.

Link copied to clipboard
fun setPixel(x: Int, y: Int, newColor: Color)

Sets the pixel at (x, y) to newColor.

Link copied to clipboard
fun writeLDRImage(stream: OutputStream, format: String, gamma: Float = 1.0f)

Saves the current image to stream in LDR format (e.g. "png", "jpg") applying gamma correction through P_out = P_in^(1/gamma).

Link copied to clipboard
fun writePFMFile(fileName: String, order: ByteOrder = LITTLE_ENDIAN)

Uses the writePFMImage fun to save this image to fileName in PFM format.

Link copied to clipboard
fun writePFMImage(stream: OutputStream, order: ByteOrder)

Writes this image to stream in PFM format with order endianness.